﻿using System.Collections.Generic;
using System.Linq;

namespace Pap.Data
{
    /// <summary>
    /// 
    /// </summary>
    public partial class wfStep : IwfStep
    {

        #region IwfStep Members


        /// <summary>
        /// Gets the wf actions.
        /// </summary>
        IEnumerable<IwfAction> IwfStep.wfActions
        {
            get { return this.wfActions.OfType<IwfAction>(); }
        }

        /// <summary>
        /// Gets the wf step roles.
        /// </summary>
        IEnumerable<IwfStepRole> IwfStep.wfStepRoles
        {
            get { return this.wfStepRoles.OfType<IwfStepRole>(); }
        }

        #endregion

        #region IwfStep Members


        /// <summary>
        /// Gets the wf step permissions.
        /// </summary>
        public IEnumerable<IPermission> wfStepPermissions
        {
            get
            {
                return this.wfStepRoles.SelectMany(wfrole => wfrole.Role.RolesPermissions.Select(roleperm => roleperm.Permission)).OfType<IPermission>();
            }
        }

        #endregion
    }
}
